Hello - New to netmaker and playing around with di...
# client
h
Hello - New to netmaker and playing around with different scenarios... I have 'Allow Node Signup Without Keys' set to 'On'; how do I now connect a node to the network?
b
you can either join with a token (using -t flag to join) or with user login (-u -n -s flags to join) ....
h
I can connect using a token and -t, I envisaged a flow where I didn't need a token and could admin-authorise connection requests, is that possible? Apologies if asking basics
b
yes and no.... the functionality is theoretically there but no one was using it and right now there is no way to pass all the required flags to join to actually join without a token... so you could say that functionally is deprecated.
h
Ah perfect, thank you for the straight answer otherwise I would have wasted hours messing about
a
@bored-island-21407 if the functionality was there in the past, how did it really work ? I am interested to sign up nodes manually and authorising them singularly, can you give some internals how this could be achieved ? at the moment using an IngressGW node with Ext_Clients is the current workaround. given that the AccessToken is base64 encoded and all information is available at hand how can i replicate what netclient does without netclient 😉
b
you would make a post to
https://api.<yourdomain>/api/nodes/<network>
with the github.com/gravitl/netmaker/models.JoinData as the payload
the way it worked in the past, the node would be added to the database with an attribute of pending set to true.... the admin could then approve which would set the pending attribute to false and the node would fu;nction normally
a
Thanks for the info, I just tried the API POST call but
/api/nodes/{network}
acc to the swagger apis.docs takes no parameters ! and the call returns a
401 "You are unauthorized to access this endpoint."
even though other POST calls work with “Authorization: Bearer ” (taken from my env: in docker) a simple GET call returns correctly the complete JSON object of the existing Node (example the server side node itself "netmaker-1" - what could I be possibly missing there ? wrt. Authorization .
b
you need to send
Authoriization: Bearer JoinData.Key
as auth header
a
I tried that
JoinData.Key = AccessToken.AccessKey
but still getting
"Code": 401
PS: tried only AccessToken as well with no luck. I notice that the AccessToken already has the AccessKey as base64 encoded , do we really need to give it again as .AccessKey ?
b
the auth middleware needs the key in the auth header, the logic portion of the code needs to keep track of keys but does not have access to the http Headers so the data has to be included twice
a
ok, makes sense, thanks for the explanation, but i still cannot get Authorized, just to be sure : - by `JoinData `you mean the
Access Token
?
b
JoinData consists of 3 pieces of information ... a Host structure, a Node structure and Key=; not all the fields in the Host and Node structure need to have values but the majority of them do.
a
still not able to get Code: 200 , can you give me an example of the full API POST call ?
b
data included in post
a
Hmmn, thanks again, just noticed that your version is 0.18.0 , I'm still on 0.17.0 . will have to try tomorrow with a fresh head , although I noticed that the struct has the key property at the end, mine did not , so will have to reorder the structure and try tomorrow. Thanks for file and information. will post back here tomorrow.